package cn.com.digitalnet.ad.util;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.com.digitalnet.ad.entity.User;

/**
 * 简化在程序的各个位置获得request/response/session/application/user实例
 * @author qidafang
 */
public class Holder {
	public static ServletContext application = null;
	public static ThreadLocal<HttpServletRequest> request = new ThreadLocal<HttpServletRequest>();
	public static ThreadLocal<HttpServletResponse> response = new ThreadLocal<HttpServletResponse>();
	public static ThreadLocal<HttpSession> session = new ThreadLocal<HttpSession>();
	public static ThreadLocal<Errors> errors = new ThreadLocal<Errors>();
	/**
	 * 赋值：
	 * rest请求和普通controller请求，见api包下的两个类
	 */
	public static ThreadLocal<User> user = new ThreadLocal<User>();
}
